<script type="text/javascript">
	$(document).ready(function(){
		$("#profile-form").validate({
			rules : {
				firstname : "required",
				lastname : "required",
				phone : {
					minlength : 7,
					maxlength : 40,
				},
				address : {
					maxlength : 255,
				}
			},
			messages : {
				firstname : "Please enter your firstname",
				lastname : "Please enter your lastname",
				phone : {
					minlength: "Số điện thoại cần hơn 7 kí tự",
					maxlength: "Tối đa là 40 kí tự",
				},
				address : {
					maxlength: "Tối đa là 255 kí tự",
				}
			}
		});
	});	
</script>
<?php 
	$table = "user";
	$id = $_SESSION["user_id"];
	$record = $conn->get_all_data($table,$id,1);
?>
<div id="alert"></div>
<form class="form-horizontal" id="profile-form" method="POST" onsubmit="return dashboard.admin.profile.action.update();">
	<input type="hidden" name="id" value="<?=$_SESSION["user_id"]?>" />
	<fieldset>			
		<div class="control-group">
			<label class="control-label">First Name</label>
			<div class="controls">
				<input type="text" id="firstname" class="input-xlarge" value="<?=$record['firstname'] ?>" name="firstname" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Last Name</label>
			<div class="controls">
				<input type="text" id="lastname" class="input-xlarge" value="<?=$record['lastname'] ?>" name="lastname" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Phone</label>
			<div class="controls">
				<input type="text" id="phone" class="input-xlarge" value="<?=$record['phone'] ?>" name="phone" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Address</label>
			<div class="controls">
				<input type="text" id="address" class="input-xlarge" value="<?=$record['address'] ?>" name="address" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">Email</label>
			<div class="controls">
				<input type="text" id="email" class="input-xlarge" value="<?=$record['email'] ?>" name="email" />
			</div>
		</div>
		<div class="form-actions">
			<button class="btn btn-primary" type="submit">Save changes</button>
			<a href="javascript:void(0)" onclick="javascript:history.go(-1);" class="btn">Cancel</a>
		</div>
	</fieldset>
</form>